var app = new Vue({ el: '#app', data: { title123: 'sss', backBanner: "", solution: [], solution_type: 1, id: null, array: [], solutionTypes: [], colin: '0' }, computed: { }, created: function () { this.solution_type = this.getQueryVariable('solution_type') this.id = this.getQueryVariable('id') this.backBanner = '../assets/img/solution/solution-banner1.jpg' }, mounted: function () { console.log(this.solution_type) this.getColumnData() $.ajax({ type: 'POST', dataType: 'json', url: window.FQDN + 'Solution/index', data: { id: '1' } }).done(function (arr) { _this.array = arr; }).fail(function (err) {}); }, methods: { getColumnData() { _this=this; $.ajax({ type: 'get', dataType: 'json', url: window.FQDN2 + 'siteCategory/siteCategoryList', }).done(function (res) { for (let i = 0; i < res.data.length; i++) { // console.log('存值') console.log(res.data[i].sname) console.log(window.location.pathname) if (res.data[i].children.length > 0) { if (res.data[i].categoryName == '解决方案') { // console.log(res.data[i].children) _this.solutionTypes=res.data[i].children _this.colin=_this.getQueryVariable('id') } } } $.ajax({ type: 'GET', dataType: 'json', url: window.FQDN2 + 'siteArticle/siteArticleList', data: { categoryid: _this.id ? _this.id : _this.solutionTypes[0].id } }).done(function (arr) { // _this.array = arr; }).fail(function (err) {}); }) }, facilityClick(e, item) { this.colin = e }, getQueryVariable: function (variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); } } });